<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
<h:head>
    <title>Create Package</title>
</h:head>

<h:body onload="#{PackageIM.allList()}">
	
	<h:form>
	<p:menubar>  
        <p:submenu label="Package Section" >  
            <p:menuitem value="Create Package" url="packageInsertion.xhtml" />  
            <p:menuitem value="All Packages" url="package.xhtml" />  
        </p:submenu>  
  
        <p:submenu label="Hotel Section" >  
            <p:menuitem value="Add Hotel" url="hotelInsert.xhtml" />  
            <p:menuitem value="All Hotel" url="hotel.xhtml" />  
        </p:submenu>  
        
         <p:submenu label="Transportation Section" >  
            <p:menuitem value="Add Transportation" url="transportationInsert.xhtml" />  
            <p:menuitem value="All Transportation" url="transportationMean.xhtml" />  
        </p:submenu>  
        
         <p:submenu label="Excursion Section" >  
            <p:menuitem value="Add Excursion" url="excursionInsert.xhtml" />  
            <p:menuitem value="All Excursion" url="excursion.xhtml" />  
        </p:submenu>  
  
       <f:facet name="options">   
       		<p:commandButton value="Check OutDated Package" action="#{CheckInvalid.checkAll()}"/>
            <p:commandButton value="Logout" action="#{LoginManaged.logout()}"/>
       </f:facet>
    </p:menubar> 
    </h:form>
	
	<h:form>
	
	<p:growl id="growl" sticky="true" showDetail="true"/> 
	
	<p:wizard flowListener="#{PackageIM.onFlowProcess}">  
      
		<p:tab id="going" title="Going">  
            <p:panel header="Going">       
                <p:selectOneListbox value="#{PackageIM.selectedG}" style="width:100%;" required="true" >
   					<f:selectItems value="#{PackageIM.gDTO}" var="g" itemLabel="#{g.departurePlace}->#{g.arrivalPlace}:#{g.departureDate}-#{g.arrivalDate}" itemValue="#{g.id}" />
   				</p:selectOneListbox>
            </p:panel>  
        </p:tab>  
              
        <p:tab id="return" title="Return">  
            <p:panel header="Return">  
              <p:selectOneListbox value="#{PackageIM.selectedR}" style="width:100%;" required="true">
   					<f:selectItems value="#{PackageIM.rDTO}" var="r" itemLabel="#{r.departurePlace}->#{r.arrivalPlace}:#{r.departureDate}-#{r.arrivalDate}" itemValue="#{r.id}" />
   				</p:selectOneListbox>
            </p:panel>  
        </p:tab>  
              
        <p:tab id="hotel" title="Hotel">  
            <p:panel header="Hotels">       
                <p:selectOneListbox value="#{PackageIM.selectedH}" style="width:100%;" required="true">
   					<f:selectItems value="#{PackageIM.hDTO}" var="h" itemLabel="#{h.name} - #{h.city} - #{h.price}" itemValue="#{h.id}" />
   				</p:selectOneListbox>
            </p:panel>  
        </p:tab>  
        
         <p:tab id="excursion" title="Excursion">  
            <p:panel header="Excursion">    
              <p:selectOneListbox value="#{PackageIM.selectedE}" style="width:100%;">
   					<f:selectItems value="#{PackageIM.eDTO}" var="e" itemLabel="#{e.name} - #{e.city}" itemValue="#{e.id}" />
   				</p:selectOneListbox>
   			
            </p:panel>  
        </p:tab>  
        
        <p:tab id="fine" title="Package">  
            <p:panel header="Package">  
            <p:panelGrid columns="3">
				<p:outputLabel value = "Name:"/>
				<p:inputText id="name" value="#{PackageIM.pDTO.name}"/>
				<p:message for="name" />
				
				<p:outputLabel value = "Description:"/>
				<p:inputText id="description" value="#{PackageIM.pDTO.description}"/>
				<p:message for="description" />
						
				<p:outputLabel value = "Nation:"/>
				<p:inputText id="nation" value="#{PackageIM.pDTO.nation}"/>
				<p:message for="nation" />
				
				<p:outputLabel value = "Price:"/>
				<p:inputText id="price" value="#{PackageIM.pDTO.price}"/>
				<p:message for="price" />
   			</p:panelGrid>
   				<p:commandButton value="Submit"   
                            action="#{PackageIM.create()}" ajax="false" />
            </p:panel>  
        </p:tab>  
        
    </p:wizard> 
    <p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />
	</h:form>
</h:body>
</html>